(function($, doc) {
	$.init({});		
	var userinfo = app.getState() || {};
    var uid = userinfo.user_id;
    
window.onload = function(){
	 
	mui.plusReady(function(){
	  	var article_id=plus.webview.currentWebview().article_id;
	  	//从服务器获取数据
	  	$.ajax({
				url: apiurl + "Article/book_detail/",
				data: {'id':article_id,'_token':userinfo.token},
				async: true,
				dataType: 'json',
				crossDomain: true, //强制使用5+跨域
				type: 'post',
				timeout: 10000,
				success: function(data) {
					console.log(JSON.stringify(data));
					if(data.status ==-3){
						mui.toast(data.msg);
						app.out();
						return false;
					}else{
						// 请求成功
						doc.getElementById('mui-title').innerText='标题: '+data.d.title;
						doc.getElementById('new_detail').innerHTML=data.d.content;
						if(data.d.hasimg==1){
							var htm='';
							var imgob=data.d.img_path;
							for(z in imgob){
								htm+='<p><img src="'+imgob[z]+'" width="300" height="auto"></p>';
							}
							doc.getElementById('cimg').innerHTML=htm;
						}
						doc.getElementById('replay_detail').innerHTML=data.d.reply_content;
					}
				},
				error: function(xhr, type, errorThrown) {
					//console.log(JSON.stringify(xhr));
					//console.log(JSON.stringify(type));
					//console.log(JSON.stringify(errorThrown));
					mui.toast('获取数据失败！');
				}
		});
	  	
		//关闭等待框
		plus.nativeUI.closeWaiting();
		//显示当前页面
		mui.currentWebview.show();
	});
}

}(mui, document));